package com.pandy.code;

/**
 * 位运算相关
 */
public class Code01_Bitwise {

    public static void main(String[] args) {
        int num = -1024;
        printBinary(num);
    }

    /**
     * 打印一个整数32位二进制
     * @param num
     */
    public static void printBinary(int num) {
        for (int i=31; i>=0; i--) {
            System.out.print( (num & (1 << i)) == 0 ? "0" : "1" );
        }
        System.out.println();
    }
}
